import { number, string } from 'prop-types';

export const demoSrc =
  'https://images.unsplash.com/photo-1567945716310-4745a6b7844b?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=300&q=60';

// export async function mockUpload(file: File) {
//   await sleep(3000)
//   return {
//     url: URL.createObjectURL(file),
//   }
// }
//
// export async function mockUploadFail() {
//   await sleep(3000)
//   throw new Error('Fail to upload')
// }

export function markHeadName(total: number, max: number) {
  let genArr: Array<any> = [];
  while (genArr.length < total) {
    if (genArr.length == 0) {
      let genNum: number = Math.floor(Math.random() * 1000 + 1);
      if (genNum < max) {
        genArr.push(genNum);
      }
    } else {
      let genStr: string = genArr.join(',');
      let genNum: number = Math.floor(Math.random() * 1000 + 1);
      if (genNum < max) {
        if (genStr.indexOf(genNum.toString()) == -1) {
          genArr.push(genNum);
        }
      }
    }
  }
  console.log(genArr);
  return genArr;
}
